[supervisord]
redirect_stderr=true
stopsignal=QUIT
autorestart=true
directory=/root

[program:nginx]
priority=10
command=nginx -c /etc/nginx/nginx.conf -g 'daemon off;'

[program:web]
priority=10
directory=/usr/local/lib/web/backend
command=/usr/local/lib/web/backend/run.py
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/dev/fd/1
stderr_logfile_maxbytes=0

{% if desktop == "lxde" %}
[group:x]
programs=xvfb,wm,lxpanel,pcmanfm,x11vnc,novnc

[program:wm]
priority=15
command=/usr/bin/openbox
environment=DISPLAY=":1",HOME="/root",USER="root"

[program:lxpanel]
priority=15
directory=%HOME%
command=/usr/bin/lxpanel --profile LXDE
user=%USER%
environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%"

[program:pcmanfm]
priority=15
directory=%HOME%
command=/usr/bin/pcmanfm --desktop --profile LXDE
user=%USER%
environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%"
{% endif %}

{% if desktop == "lxqt" %}
[group:x]
programs=xvfb,wm,lxpanel,x11vnc,novnc

[program:wm]
priority=15
command=/usr/bin/openbox
environment=DISPLAY=":1",HOME="/root",USER="root"

[program:lxpanel]
priority=15
directory=%HOME%
command=/usr/bin/startlxqt
user=%USER%
environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%"
{% endif %}

{% if desktop == "xfce4" %}
[group:x]
programs=xvfb,lxpanel,x11vnc,novnc

[program:lxpanel]
priority=15
directory=%HOME%
command=/usr/bin/startxfce4
user=%USER%
environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%"
{% endif %}

[program:xvfb]
priority=10
command=/usr/local/bin/xvfb.sh
stopsignal=KILL

[program:x11vnc]
priority=20
command=x11vnc -display :1 -xkb -forever -shared -repeat

[program:novnc]
priority=25
directory=/usr/local/lib/web/frontend/static/novnc
command=bash /usr/local/lib/web/frontend/static/novnc/utils/launch.sh --listen 6081
stopasgroup=true
